//
//  Tokenizer.h
//  Solver
//
//  Created by Nicolas Winkler on 12.07.13.
//  Copyright (c) 2013 Nicolas Winkler. All rights reserved.
//


#ifndef _SOLVER_TOKENIZER_H
#define _SOLVER_TOKENIZER_H
#include <vector>
#include <string>

namespace solver
{
    struct Token;
    class Tokenizer;
}


struct solver::Token
{
    enum Type
    {
        NUMBER,
        TEXT,
        SYMBOL
    } type;
    std::string token;
};


class solver::Tokenizer
{
private:
    std::string input;
    std::vector<Token> tokens;
    
public:
    Tokenizer(const std::string&);
    ~Tokenizer(void);
    
    void run(void);
    
    const Token& getToken(unsigned int) const;
    unsigned long getNTokens(void) const;
    
private:
    enum CharType
    {
        NORMAL,
        TOKEN,
        SPACE,
        NUMBER
    };
    
    static CharType charType(char);
};

#endif // _SOLVER_TOKENIZER_H
